package com.liyunc.socket.keepalive.client;

import java.nio.charset.StandardCharsets;

public class DstClient extends Thread {
    @Override
    public void run() {
        try {
            ClientSender instance = ClientSender.getInstance();
            new Thread(new Runnable() {
                @Override
                public void run() {
                    instance.sendHeart();
                }
            }).start();
            new Thread(new Runnable() {
                @Override
                public void run() {
                    int i = 1;
                    while (true) {
                        try {
                            Thread.sleep(1000);
                            i = i * i;
                            String data = i + "";
                            System.out.println("/////" + data);
                            instance.send(data.getBytes(StandardCharsets.UTF_8));
                            i++;
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }).start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
